<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  Function.prototype.myBind=function (isArg,...args){
    return(...myArgs)=> this.call(isArg,...args,...myArgs)
  }
  function func(a,b,c,d){
    console.log(this.name)
    return a+b+c+d;
  }
  var person ={
    name:'123'
  }
  const bindFn =func.myBind(person,1,2);
  const res = bindFn(3,4);
  console.log(res)


  const numArr = [1, 4, 98, 170, 35, 87]
  const sortedArr = numArr.sort(function(a, b) {
    return a - b
  })
  console.log(sortedArr)


  const typeOftype = type=> thing=> typeof type===thing
  const isString = typeOftype('string')
  isString('123')
  isString(1)

  const typeOftype1 = function (type){
    function fun(thing){
      return typeof  thing===type
    }
    return fun
  }

const test1 = typeOftype1('string');
  test1('223')



  //var foo = 1
    var a=1
  (function foo() {
   a = 10
    console.log(a)
  }()) // -> ƒ foo() { foo = 10 ; console.log(foo) }




  navigator.serviceWorker.register().then(res=>{}).catch()
</script>
</body>
</html>
